<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta charset="UTF-8">
	<title>{if:isset($seo_title) && isset($site_title) && ($seo_title == $site_title)}{$seo_title}{else:}{$seo_title}-{$site_title}{/if}</title>
	<meta name="description" content="{$seo_description}">
	<meta name="Keywords" content="{$seo_keywords}">
	<meta http-equiv="X-UA-Compatible" content="IE=Edge">
	<link href="{url:@static/images/favicon.png}" rel="apple-touch-icon-precomposed">
	<link type="image/x-icon" href="{url:@favicon.ico}" rel="icon">
	<link type="text/css" rel="stylesheet" href="{url:#css/common.css}" />
		<!--[if IE 6]>
		<script src="{url:#js/DD_belatedPNG-min.js}"></script>
		<script>DD_belatedPNG.fix('.ie6png');</script>
		<![endif]-->
		<script type="text/javascript">
			var server_url = '{url:@}__con__/__act__';
			var Tiny = {user:{name:'{$user['name']|''}',id:'{$user['id']|0}',online:{$user['id']|'true'|'false'}}};
		</script>
		{echo:JS::import('jquery');}
		<script type='text/javascript' src="{url:#js/common.js}"></script>
		<!--S 一个页面只引入一次即可-->
		<link rel="stylesheet" type="text/css" href="{url:#js/jslider.css}" />
		<script type='text/javascript' src="{url:#js/jslider.js}"></script>
		<!--E 只引入一次-->

	</head>
	<body>
		<script type="text/javascript">if(screen.width < 1200) { document.getElementsByTagName('body')[0].className = 'screen_960'; }</script>

		<!--S 头部 -->
		<div id="header" class="clearfix">
			<div class="header-bar">
				<div class="wrap nav">
					<ul class=" fr">
						{if:$user}
						<li>你好<b>{$user['name']}</b> [<a href="{url:/simple/logout}">安全退出</a>]，{$site_name}！</li>
						<li><a href="{url:/ucenter/order}">我的订单</a></li>
						{else:}
						<li><a href="{url:/simple/login}"><b>登录</b></a></li>
						<li><a href="{url:/simple/reg}">注册</a></li>
						{/if}
						<li><a href="{url:/index/help_index}">帮助中心</a></li>
					</ul>
				</div>
			</div>
			<div class="header-main">
				<div class="wrap">
					<div class="logo "><a href="{url:/index/index}"><img class="ie6png" src="{url:@$site_logo}" style="max-height:74px;"></a></div>
					<div class="header-search fl">
						<form id="search-form" action="{url:/}" method="get">
							<input type="hidden" name="con" value="index">
							<input type="hidden" name="act" value="search">
							{token:}
							<input id="search-keyword" class="txt-keyword" name="keyword" value="{$keyword}" type="text"><button type="submit" class="btn-search fl"><b>搜 索</b></button>
						</form>
						<p id="tags-list"><b>热门标签：</b>{query:name=tags order=is_hot desc,sort desc,num desc limit=6}<a href="#">{$item['name']}</a>{/query}</p>
					</div>
					<div class="header-cart">
						<dl class="fr">
							<dt ><i class="icon-member ie6png vm"></i><a class="vm" href="{url:/ucenter/index}">我的商城</a><s class="b-triangle"></s></dt>
							<dd class="cart-list">
								{set:$sidebar_nav = array('我的订单'=>'order', '我的关注'=>'attention', '商品咨询'=>'consult', '商品评价'=>'review', '我的消息'=>'message', '收货地址'=>'address', '我的优惠券'=>'voucher', '账户金额'=>'account');}
								<ul>
									{list:items=$sidebar_nav }
									<li><a href="{url:/ucenter/$item}">{$key}</a></li>
									{/list}
								</ul>
							</dd>
						</dl>
					</div>
				</div>
			</div>
			<div class="header-nav" id="float">
				<div class="wrap">
					<ul class="nav">
						<li><a href="{url:/index/index}">首页</a></li>
						{query:name=nav  where=type eq 'main' and enable eq 1 order=`sort` desc}
						<li><a href="{if:strstr($item['link'],'http://')===false}{url:$item[link]}{else:}{$item['link']}{/if}" target="{if:$item['open_type']==1}_blank{else:}_self{/if}">{$item['name']}</a></li>
						{/query}
					</ul>
					<div class="category">
						<h3 ><a href="#" ><i class="icon-list ie6png vm"></i>全部商品分类<s class="b-triangle vm"></s></a></h3>
						<div style="height: 410px;" class="group clearfix">
						{set:$current_category_ids='';$parent_category='';}
							{list:items=$category item=$categ}
							<dl>
								<dt>
									<h4><a href="{url:/index/category/cid/$categ[id]}">
									{if:isset($categ['id'])}
                                    {set:$current_category_ids=$categ['id'].',';$parent_category=$categ['id'];}
                                    {/if} {$categ['title']}</a></h4>
								</dt>
								<dd>
									<ul class="sub">
										{list:items=$categ['child'] item=$child}
										<li>
											<h5><a href="{url:/index/category/cid/$child[id]}">
											{if:isset($child['id'])}
                                            {set:$current_category_ids.=$child['id'].',';}
                                            {/if}
											{$child['title']}</a></h5>
											<p>
												{if:isset($child['child'])}
												{list:items=$child['child'] item=$grandson}
												<a href="{url:/index/category/cid/$grandson[id]}">
												{if:isset($grandson['id'])}
                                                {set:$current_category_ids.=$grandson['id'].',';}{/if}
												{$grandson['title']}</a>
												{/list}
												{/if}
											</p>
										</li>
										{/list}
									</ul>
									<ul class="brand">
                                        <li>推荐品牌</li>
                                        <li>
                                        {set:$current_category_ids = trim($current_category_ids,',')}
                                        {query:name=goods as go fields=br.name,br.id join=left join brand as br on go.brand_id eq br.id where=go.category_id in($current_category_ids) group=go.brand_id cache=true}
                                        {if:$item['name']!=''}
                                        <span><a href="{url:/index/category/cid/$parent_category/sort/0/brand/$item[id]}">{$item['name']}</a></span>
                                        {/if}
                                        {/query}
                                        </li>
                                    </ul>
								</dd>
							</dl>
							{/list}
						</div>
					</div>
				</div>
			</div>
		</div>
		<!--E 头部 -->
		<!--S content-->
		<div id="content">
			<div class="wrap">
				{__viewcontents}
			</div>
		</div>
		<!--E content-->
		<!--S 底部 -->
		<div id="footer" class="mt20  ">
			<div class="wrap">
				<div class="footer-main clearfix">
					{query:name=help_category order=sort desc limit=5}
					<dl >
						<dt class="clearfix"><span class="icon-{$item['alias']} fl"></span><a href="javascript:;">{$item['name']}</a></dt>
						{query:name=help where= category_id eq $item[id] item=$help cache=true cacheTime=1200}
						<dd><a href="{url:/index/help/id/$help[id]}">{$help['title']}</a></dd>
						{/query}
					</dl>
					{/query}
				</div>
				<div class="footer-links">
					<p><a><b>友情连接：</b></a><a href="http://www.tinyrise.com">济南泰创软件科技有限公司</a></p>
				</div>
				<div class="copyright">
					<div>{query:name=nav where=type eq 'bottom' order=`sort` desc}
					<a href="{if:strstr($item['link'],'http://')===false}{url:$item[link]}{else:}{$item['link']}{/if}" target="{if:$item['open_type']==1}_blank{else:}_self{/if}">{$item['name']}</a>
					{/query}</div>
					<!--S 济南泰创软件科技有限公司保留所有版权，非授权用户严禁删除版权信息；擅自删除，后果自负，您的支持是我们成长的动力。-->
					<div><span>Powered by <a href="http://www.tinyrise.com"><b style="color: #7c0000">Tiny</b><b style="color: #666">Shop</b></a></span> © 2014 <a href="http://www.tinyrise.com">tinyrise.com</a> . 保留所有权利 。{$site_icp} </div>
					<!--S 济南泰创软件科技有限公司保留所有版权，非授权用户严禁删除版权信息；擅自删除，后果自负，您的支持是我们成长的动力。-->
				</div>
			</div>

		</div>
		<!--S 购物车 -->
		<div id="shopping-cart" >

			<div id="card-wrap" class="ie6png">
				<div class="clearfix" style="height: 32px;"><a href="{url:/simple/cart}" class="fr btn btn-gray" style="padding: 2px 6px;font-size: 12px;" target="_blank">查看购物车</a></div>
				<div id="card-list">
					{set:$total=0.00;}
					{list:items=$cart}
					{set:$total += $item['amount'];}
					<div class="card-item" id="{$item['id']}">
						<div class="pic">
							<a class="card-pic" href="{url:/index/product/id/$item[goods_id]}" target="_blank" title="{$item['name']}"><img src="{url:@$item[img]}" width="50" height="50"></a></div>
							<div class="spec">
								{list:items=$item['spec'] item=$spec}
								<p title="{$spec['name']}:{$spec['value'][2]}">{$spec['value'][2]}</p>
								{/list}
							</div>
							<div class="num">{$item['num']}</div>
							<div class="price" title="{$item['amount']}">{$item['amount']}</div>
							<a class="icon-close ie6png" productid="{$item['id']}"></a>
						</div>
						{/list}
					</div>
				</div>
				<div id="shopping-bar-box" >
					<div id="shopping-bar">
						<div class="fl tl" style="padding-left:8px;" > <i class="icon-cart ie6png" style="zoom:1;"></i><span style="zoom:1;">购物车(<b class="cart-product-num">{echo:count($cart)}</b>)</span></div> 
						<span class="fr tr">
							<div style="padding-right:12px;"><span class="currency-symbol">{$currency_symbol}</span><b class="cart-total">{echo: sprintf("%01.2f",$total)}</b></div>
						</span>
					</div>
					<a id="settlement" href="{url:/simple/cart}">去结算</a>
				</div>
			</div>
			<script type="text/javascript">
				$("#shopping-cart").on("mouseenter",function(){
					if($("#card-wrap").position().top>-15)$("#card-wrap").animate({top:"-15px"},100);
				});
				$("#shopping-cart").on("mouseleave",function(){
					if($("#card-wrap").position().top==-15)$("#card-wrap").animate({top:"-5px"},"fast");
				});
				$(document).on("click",function(e){
					$("#card-wrap").animate({top:"-5px"},"fast");
				})
				$("#shopping-cart").on("click",function(e){
					if (e.stopPropagation) {e.stopPropagation();}     
					e.cancelBubble = true;
				});
				$("#shopping-bar").on("click",function(e){
			//for(i in e)alert(i+'==='+e[i]);
			var currentNode = e.currentTarget;
			//alert(currentNode.id);
			//if (e.stopPropagation) {e.stopPropagation();}     
			//e.cancelBubble = true;
			if($("#card-wrap").outerHeight()>360)$("#card-wrap").css("height","360px");
			if($("#card-wrap").position().top>=-15)$("#card-wrap").animate({top:1-$("#card-wrap").outerHeight()},"fast");
			else{
				$("#card-wrap").animate({top:"-5px"},100);
			}
			return false;
		});

				function updateCart(data){
					var card_items = '';
					for(var i in data){
						var spec = data[i]['spec'];
						var spec_str = '';
						for(var k in spec){
							spec_str +="<p>"+spec[k]['value'][2]+"</p>";
						}
						card_items += '<div class="card-item" id="'+i+'"><div class="pic"><img src="{url:@}'+data[i]['img']+'" width="50" height="50"></div><div class="spec">'+spec_str+'</div><div class="num">'+data[i]['num']+'</div><div class="price">'+(data[i]['amount'])+'</div><a class="icon-close ie6png" productid="'+data[i]['id']+'"></a></div>';
					}
					$("#card-list").empty().append(card_items);
					changeCartInfo();
					bindDelEvent();
				}
				bindDelEvent();
				function bindDelEvent(){
					$("#shopping-cart .icon-close").on("click",function(){
						var btn_close = $(this);
						$.post("{url:/index/cart_del}",{id:btn_close.attr("productid")},function(){
							btn_close.parent().remove();
							changeCartInfo();
							$("#card-wrap").css({top:1-$("#card-wrap").outerHeight()},"fast");
						},"json");
					});
				}

				function changeCartInfo(){
					$(".cart-product-num").text($(".card-item").size());
					var total = 0.00;
					$(".card-item .price").each(function(){
						total += parseFloat($(this).text());
					});
					$(".cart-total").text(total.toFixed(2));
				}
				$("#tags-list a").each(function(){
					$(this).on("click",function(){
						$("#search-keyword").val($(this).text());
						$("#search-form").submit();
					})
				})
        //导航高亮
        $(".header-nav .nav li").has("a[href='{$url_index}']").addClass("current");
        //
        $(".header-cart dl,.category,.category .group dl").hover(
        	function () {
        		$(this).addClass("hover");
        	},
        	function () {
        		$(this).removeClass("hover");
        	}
        	);
        </script>
        <!--E 购物车 -->
        <!--E 底部 -->
    </body>
    </html>